package com.ruowei.modules.foodOrder.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;

import com.ruowei.modules.foodOrder.domain.enumeration.FlowType;

/**
 * 支付流水表
 */
@ApiModel(description = "支付流水表")
@Entity
@Table(name = "payment_flow")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class PaymentFlow implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @Column(name = "order_code")
    private String orderCode;

    /**
     * 退款编码
     */
    @ApiModelProperty(value = "退款编码")
    @Column(name = "order_return_code")
    private String orderReturnCode;

    /**
     * 用户openId
     */
    @ApiModelProperty(value = "用户openId")
    @Column(name = "member_code")
    private String memberCode;

    /**
     * 流水类型
     */
    @ApiModelProperty(value = "流水类型")
    @Enumerated(EnumType.STRING)
    @Column(name = "jhi_type")
    private FlowType type;

    /**
     * 交易日期
     */
    @ApiModelProperty(value = "交易日期")
    @Column(name = "jhi_date")
    private LocalDate date;

    /**
     * 交易时间
     */
    @ApiModelProperty(value = "交易时间")
    @Column(name = "jhi_time")
    private Instant time;

    /**
     * 商家编码
     */
    @ApiModelProperty(value = "商家编码")
    @Column(name = "merchant_code")
    private String merchantCode;

    /**
     * 商家名称
     */
    @ApiModelProperty(value = "商家名称")
    @Column(name = "merchant_name")
    private String merchantName;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @Column(name = "amount", precision = 21, scale = 2)
    private BigDecimal amount;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public PaymentFlow orderCode(String orderCode) {
        this.orderCode = orderCode;
        return this;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getOrderReturnCode() {
        return orderReturnCode;
    }

    public PaymentFlow orderReturnCode(String orderReturnCode) {
        this.orderReturnCode = orderReturnCode;
        return this;
    }

    public void setOrderReturnCode(String orderReturnCode) {
        this.orderReturnCode = orderReturnCode;
    }

    public String getMemberCode() {
        return memberCode;
    }

    public PaymentFlow memberCode(String memberCode) {
        this.memberCode = memberCode;
        return this;
    }

    public void setMemberCode(String memberCode) {
        this.memberCode = memberCode;
    }

    public FlowType getType() {
        return type;
    }

    public PaymentFlow type(FlowType type) {
        this.type = type;
        return this;
    }

    public void setType(FlowType type) {
        this.type = type;
    }

    public LocalDate getDate() {
        return date;
    }

    public PaymentFlow date(LocalDate date) {
        this.date = date;
        return this;
    }

    public void setDate(LocalDate date) {
        this.date = date;
    }

    public Instant getTime() {
        return time;
    }

    public PaymentFlow time(Instant time) {
        this.time = time;
        return this;
    }

    public void setTime(Instant time) {
        this.time = time;
    }

    public String getMerchantCode() {
        return merchantCode;
    }

    public PaymentFlow merchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
        return this;
    }

    public void setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
    }

    public String getMerchantName() {
        return merchantName;
    }

    public PaymentFlow merchantName(String merchantName) {
        this.merchantName = merchantName;
        return this;
    }

    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public PaymentFlow amount(BigDecimal amount) {
        this.amount = amount;
        return this;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof PaymentFlow)) {
            return false;
        }
        return id != null && id.equals(((PaymentFlow) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "PaymentFlow{" +
            "id=" + getId() +
            ", orderCode='" + getOrderCode() + "'" +
            ", orderReturnCode='" + getOrderReturnCode() + "'" +
            ", memberCode='" + getMemberCode() + "'" +
            ", type='" + getType() + "'" +
            ", date='" + getDate() + "'" +
            ", time='" + getTime() + "'" +
            ", merchantCode='" + getMerchantCode() + "'" +
            ", merchantName='" + getMerchantName() + "'" +
            ", amount=" + getAmount() +
            "}";
    }
}
